// pages/detail/detail.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    productId:"",
    background:['https://s1.328888.xyz/2022/06/02/WJKAk.jpg','https://s1.328888.xyz/2022/06/02/WJnX3.jpg','https://s1.328888.xyz/2022/06/02/WJ1p4.jpg'],
    showtitle:"",
    showprie:"",
    showdesc:"",
    showimage:"",
    autoplay:true,
    indicatorDots:true,
    vertical:false,
    interval:3000,
    duration:500,
    goodsDetail:[
      {
        "Title":"杨枝甘露（大）",
        "GoodsDescribe":"先剥先切鲜芒果，搭配醇厚椰乳，口味地道，浓郁清爽",
        "SaleAmount":19,
        "id":"101",
        SwiperImgList:[
            "https://s1.328888.xyz/2022/06/02/WJKAk.jpg",
            "https://s1.328888.xyz/2022/06/02/WJnX3.jpg",
            "https://s1.328888.xyz/2022/06/02/WJ1p4.jpg"
          ]
      },{
        "Title":"杨枝甘露（中）",
        "GoodsDescribe":"先剥先切鲜芒果，特调椰奶，口味地道，浓郁清爽",
        "SaleAmount":17,
        "id":"102",
      },{
        "Title":"鲜柠檬山茶花",
        "GoodsDescribe":"山茶花乌龙茶，口感酸酸甜甜，花香浓郁，新鲜的味道",
        "SaleAmount":10,
        "id":"103",
      },{
        "Title":"鲜草莓奶茶",
        "GoodsDescribe":"新鲜红颜草莓搭配山茶花，花香果香，芬芳馥郁",
        "SaleAmount":12,
        "id":"104",
      },{
        "Title":"葡萄多肉酪酪",
        "GoodsDescribe":"茶香清雅，果香怡人，芝士浓郁，三重美味，尽在一杯",
        "SaleAmount":18,
        "id":"105",
      },{
        "Title":"超级西瓜汁",
        "GoodsDescribe":"鲜甜西瓜，新鲜鲜榨西瓜，真材实料看得见；超大一杯，超级满足",
        "SaleAmount":15,
        "id":"106",
      },{
        "Title":"生椰拿铁（中）",
        "GoodsDescribe":"精选阿拉比卡优质咖啡豆现萃香醇，邂逅鲜椰冷榨生椰乳，椰香四溢，浓郁清爽",
        "SaleAmount":15,
        "id":"107",
      },{
        "Title":"生椰拿铁（小）",
        "GoodsDescribe":"精选阿拉比卡优质咖啡豆现萃香醇，邂逅鲜椰冷榨生椰乳，椰香四溢，浓郁清爽",
        "SaleAmount":14,
        "id":"108",
      },
      {
        "Title":"美式咖啡",
        "GoodsDescribe":"醒神必备！精选阿拉比卡优质咖啡豆现萃香醇，唤醒一天的好精神",
        "SaleAmount":11,
        "id":"109",
      }
    ],
    detailInfo:{
      // "Title":"杨枝甘露",
      // "GoodsDescribe":"先剥先切鲜芒果，特调椰奶，口味地道，浓郁清爽",
      // "SaleAmount":17,
      // SwiperImgList:[
      //   "/images/goodsone.jpg",
      //   "/images/goodstwo.jpg",
      //   "/images/goodsthree.jpg"
      // ]
      
    },
    //添加到购物车
  
    goodsNumber:""

  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    const {goodsId}=options
    this.setData({
      showtitle:this.data.goodsDetail[goodsId].Title,
      showprice:this.data.goodsDetail[goodsId].SaleAmount,
      showdesc:this.data.goodsDetail[goodsId].GoodsDescribe,
    })
 
    
  
  },
  Add(){
    let that =this;
    wx.setStorageSync("id", this.data.options)
    wx.showToast({
      title: '加入成功',
    }) 
     
       },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})